﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AutoUpdater.Util
{
    public class SystemXmlUtil
    {
        public static XElementSetting Instance = new XElementSetting("SystemSettng.xml");
        private static string sendUrl = string.Empty;

        public static void SetClientVersion(string version)
        {
            Instance.Update("ClientVersion", version);
        }

        public static string GetClientVersion()
        {
            return Instance.GetString("ClientVersion");
        }

        public static string GetSysFileMaxVersion()
        {
            return Instance.GetString("SysFileMaxVersion");
        }

        public static void SetSysFileMaxVersion(string version)
        {
            Instance.Update("SysFileMaxVersion", version);
        }

        public static string GetServerUrl()
        {
            if(!string.IsNullOrEmpty(sendUrl))
            {
                return sendUrl;
            }
            sendUrl = Instance.GetString("ServerUrl");
            return sendUrl;
        }

        public static string GetTitle()
        {
            return Instance.GetString("Title");
        }

        public static string GetCallbackExeName()
        {
            return Instance.GetString("CallbackExeName");
        }
    }
}
